package com.atguigu.spzx.manager.service.impl;

import com.atguigu.spzx.manager.mapper.SelfCartMapper;
import com.atguigu.spzx.manager.service.SelfCartService;
import com.atguigu.spzx.model.entity.system.SysUser;
import com.atguigu.spzx.model.vo.sell.SellVo;
import com.atguigu.spzx.utils.AuthContextUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SelfCartServiceImpl implements SelfCartService {

    public String GetuserName(){
        SysUser sysUser = AuthContextUtil.get();
        String userName = sysUser.getUserName();
        return userName;
    };
    @Autowired
    private SelfCartMapper selfCartMapper;

    @Override
    public List<SellVo> GetCartProduct() {
        String userName = GetuserName();
        List<SellVo> list = selfCartMapper.GetCartProduct(userName);
        return list;
    }

    @Override
    public void DeleteCartProduct(int id) {
        selfCartMapper.DeleteCartProduct(id);
    }
}
